<template>
  <div>
    <Table :tableData="tableData" :limit="limit" :total="total" :page="page" :bln="true"></Table>
    <el-pagination background layout="prev, pager, next" :total="total" :current-page.sync="page" :page-size.sync="limit"
      @current-change="handleCurrentchange">
    </el-pagination>
  </div>
</template>

<script>
import Table from './table.vue'
import User from '../../api/product'
export default {
  name:'push',
  components: {
    Table
  },
  data() {
    return {
   
      tableData: [],
      total: 10,
      page: 1,
      limit: 10
    }
  },
  methods: {
    handleCurrentchange(val) {
      this.page = val
      User["seckilllist"]({
        type: 'isseckill',
        flag: 1
      }).then(res => {
        this.tableData = res.data
        this.tableData.map(item => {
          item.issale = item.issale == 1 
          item.isseckill = item.isseckill == 1 
          item.isrecommend = item.isrecommend == 1 
        })
        console.log(res);
      })

    }
  },
  mounted() {
    User["seckilllist"]({
      type: 'isseckill',
      flag: 1
    }).then(res => {
      console.log(res);
      this.tableData = res.data
      this.total = res.data.length || 0
      this.tableData.map(item => {
        item.issale = item.issale == 1 
        item.isseckill = item.isseckill == 1 
        item.isrecommend = item.isrecommend == 1 
      })
    })

  }
}
</script>

<style lang="scss" scoped></style>